package com.erp.freight.controller;

import com.ruoyi.freight.api.domain.ErpProductExistingFreightRecord;
import com.erp.freight.domain.ErpProductFreight;
import com.erp.freight.domain.bo.ErpProductFreightBo;
import com.erp.freight.domain.vo.ErpLogisticsServiceInfoVo;
import com.erp.freight.domain.vo.ErpProductFreightVo;
import com.erp.freight.domain.vo.ErpProductRefinementFreightVo;
import com.erp.freight.service.IErpCommonProductFreightService;
import com.erp.freight.service.IErpProductFreightService;
import com.erp.freight.service.IErpUpdateFreightTemplateService;
import com.ruoyi.common.core.annotation.RepeatSubmit;
import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.core.web.oldController.BaseController;
import com.ruoyi.common.core.web.oldPage.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.system.api.RemoteDictDataService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 运费模版相关操作
 *
 * @author zj
 * @date 2023-06-23
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/freight/template")
public class ErpFreightTemplateController extends BaseController {

    private final IErpUpdateFreightTemplateService updateFreightTemplateService;

    /**
     * 更新菜鸟物流模版
     *
     * @return
     */
    @GetMapping("/update/cainiao")
    public R<Void> updateTempByCaiNiao() {
        return toAjax(updateFreightTemplateService.updateFreightTrialTemplate("D:\\菜鸟无忧物流运费-20240118.xlsx", "CAINIAO"));
    }

    /**
     * 更新燕文物流模版
     *
     * @return
     */
    @GetMapping("/update/yanwen")
    public R<Void> updateTempByYanWen() {
        return toAjax(updateFreightTemplateService.updateFreightTrialTemplate("D:\\深圳燕文报价单20230704版.xlsx", "YANWEN"));
    }

}
